//
//  FFSuggestion_VM.m
//  Common
//
//  Created by ale tan on 16/10/24.
//  Copyright © 2016年 IT.Bear. All rights reserved.
//

#import "SendMessageRequest.h"

@implementation SendMessageRequest

- (id)init{
    self = [super init];
    if (self) {
        self.uploadImageUrl = @"user/v1/file/upload";
    }
    return self;
}

- (void)upLoadImage:(UIImage *)image Callback:(RequestResult)callback{
    self.requestCallBack = callback;
    self.needToken = YES;
    
    [ServiceManager uploadImage:image toURL:self.uploadImageUrl withName:@"file" params:self.parameters success:^(id responseObject , BOOL result) {
        if (result) {
            self.requestCallBack(responseObject,result);
        }
        else{
            [FFTipsView showTips:responseObject[@"toast"]];
        }
        
    } failure:^(id error) {
        [FFTipsView showTips:@"网络连接失败"];
        self.requestCallBack(nil,NO);
        
    }];
}

@end
